const ftpClient = require('ftp');
const fs = require('fs');

let ftp = new ftpClient();
let conn = {
    host        : '118.190.244.189',
    port        : '21',
    user        : 'ftp_test',
    password    : 'mapping_ftp',
};

ftp.connect( conn );

ftp.on('ready',function(){
    ftp.get('README.md',function( err, stream ){

        if( err ){
            throw err;
        }
        stream.once('close',function(){
            ftp.end();
        });
        stream.pipe( fs.createWriteStream('README-copy.md') );
    });

    // ftp.put('README.md','README.md',function( err ){
    //     if( err ){
    //         throw err;
    //     }
    //     ftp.end();
    // });
});